Skip to content

feat(memory): keep per-field semanticScore in memory search results - #1991

Merged
yashwagle1 merged 2 commits into
mainfrom
feat/memory-field-semantic-score
Nov 12, 2026
Merged

yashwagle1 merged 2 commits into
mainfrom
feat/memory-field-semantic-score

Conversation

@yashwagle1

@yashwagle1 yashwagle1 commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Memory search results lost each field's semantic similarity. ECS returns fields[].semanticScore and LLMOps passes it through (QueryMemorySearchHandler maps SemanticScore = f.SemanticScore into its Field model). But MemoryMatchField didn't declare it, and pydantic's default extra="ignore" dropped it. Callers, and the agent's Apply dynamic few shot span (which writes response.model_dump(...)), only saw the per-field score. In Hybrid mode that value looks like reciprocal-rank fusion (for example exactly 1/61), not a similarity. As a result, a trace couldn't show how close a field actually was.

This change:

  • adds semantic_score: Optional[float] (alias semanticScore) to MemoryMatchField; it's optional so older responses still parse
  • bumps uipath-platform to 0.3.7

The models still ignore unknown keys. That's deliberate: kept keys would be written to the Apply dynamic few shot span and the SDK's memory_search span, so new server fields should be added explicitly, as this one is. Escalation memory models are unchanged.

Tests: the sample search response now carries a field-level semanticScore. New tests cover parsing it, keeping it in a by_alias dump, and it being optional.

Follow-up: uipath-langchain needs no runtime change, because the span picks the field up automatically. Once this publishes, it gets a test pinning semanticScore on the span and a bump to uipath-platform>=0.3.7. Locally that test fails against 0.3.6 and passes against this branch.

🤖 Generated with Claude Code

LLMOps passes ECS's per-field semanticScore through on memory search,
but MemoryMatchField did not declare it and pydantic's default
extra="ignore" dropped it. Callers and the agent's "Apply dynamic few
shot" span saw only the rank-scale field score.

Add semantic_score (optional) to MemoryMatchField and let the search
response models keep unknown keys, so new server fields are no longer
silently discarded. Bump uipath-platform to 0.3.7.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@yashwagle1 yashwagle1 added the test:uipath-langchain Triggers tests in the uipath-langchain-python repository label Nov 12, 2026
Copilot AI balanced review requested due to automatic review settings November 12, 2026 23:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are reported for the changes exposing per-field semantic scores in memory search results.

No open issues 🎉

What changed in this PR

This PR preserves per-field semantic similarity in the platform SDK’s memory search results, making it available to callers and serialized traces without breaking older responses.

Changes:

  • Adds optional semantic_score, aliased to semanticScore, and preserves unknown server keys in search response models.
  • Adds tests for parsing, serialization, optional values, and unknown-key retention.
  • Bumps uipath-platform to version 0.3.7 and updates both lockfiles.
File Description
packages/​uipath/​uv.lock Updates the local platform dependency version to 0.3.7.
packages/​uipath-platform/​uv.lock Aligns the platform lockfile with version 0.3.7.
packages/​uipath-platform/​tests/​services/​test_memory_service.py Tests semantic score preservation and response compatibility.
packages/​uipath-platform/​src/​uipath/​platform/​memory/​memory.py Adds the semantic score field and retains unknown search response keys.
packages/​uipath-platform/​pyproject.toml Bumps the platform package version to 0.3.7.

Review effort: Balanced

…nknown keys

Drop extra="allow" from the search response models. Unknown keys would
flow into the agent's "Apply dynamic few shot" span and the SDK's
memory_search span without review, so new server fields should be
added deliberately, as semantic_score is.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@yashwagle1
yashwagle1 merged commit c283d54 into main Nov 12, 2026
183 checks passed
@yashwagle1
yashwagle1 deleted the feat/memory-field-semantic-score branch November 12, 2026 23:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:uipath-integrations test:uipath-langchain Triggers tests in the uipath-langchain-python repository

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants